package com.itheima;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import sun.misc.Unsafe;

import java.lang.reflect.Field;

@SpringBootApplication
@Slf4j
//@ServletComponentScan
public class SpringbootReggieApplication {

    public static void main(String[] args) {
        disableWarning(); //禁用警告

        SpringApplication.run(SpringbootReggieApplication.class, args);
        log.info("后台管理系统：http://localhost:8080/backend/index.html");
        log.info("前台手机端：http://localhost:8080/front/index.html");
    }

    public static void disableWarning() {
        try {
            Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
            theUnsafe.setAccessible(true);
            Unsafe u = (Unsafe) theUnsafe.get(null);

            Class cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
            Field logger = cls.getDeclaredField("logger");
            u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
        } catch (Exception e) {
            // ignore
        }
    }
}
